﻿using ParkSaleSDK.Adapter;
using static ParkSaleSDK.QuickTool.SelectStringMaker;
namespace ReadOnlyParkSaleAdapter
{
    /// <summary>
    /// 消息读取器
    /// </summary>
    public class readOnly_MessageAdapter : ReadableDatabaseAdapter
    {
        public readOnly_MessageAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database, c_Message.Table, username, password, port);
        }
        public readOnly_MessageAdapter()
        {

        }
        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_Message.m_id:
                    return MakeSelectStr(TableName, c_Message.k_id, value);
                case c_Message.m_time:
                    return MakeSelectStr(TableName, c_Message.k_time, value);
                case c_Message.m_content:
                    return MakeSelectStr(TableName, c_Message.k_content, value);
                case c_Message.m_from:
                    return MakeSelectStr(TableName, c_Message.k_from, value);
                case c_Message.m_type:
                    return MakeSelectStr(TableName, c_Message.k_type, value);
                case c_Message.m_to:
                    return MakeSelectStr(TableName, c_Message.k_to, value);
                case c_Message.m_handled:
                    return MakeSelectStr(TableName, c_Message.k_handled, value);

            }
        }
    }


    /// <summary>
    /// 用户拥有的房产信息读取适配器
    /// </summary>
    public class readOnly_OwnedHouseAdapter : ReadableDatabaseAdapter
    {
        public readOnly_OwnedHouseAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database, c_OwnedHouse.Table, username, password, port);
        }
        public readOnly_OwnedHouseAdapter()
        {

        }

        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_OwnedHouse.m_id:
                    return MakeSelectStr(TableName, c_OwnedHouse.k_id, value);
                case c_OwnedHouse.m_house:
                    return MakeSelectStr(TableName, c_OwnedHouse.k_house, value);
                case c_OwnedHouse.m_location:
                    return MakeSelectStr(TableName, c_OwnedHouse.k_location, value);
                case c_OwnedHouse.m_number:
                    return MakeSelectStr(TableName, c_OwnedHouse.k_number, value);
                case c_OwnedHouse.m_owner:
                    return MakeSelectStr(TableName, c_OwnedHouse.k_owner, value);

            }
        }
    }

    /// <summary>
    /// 广告读取适配器
    /// </summary>
    public class readOnly_ADAdapter : ReadableDatabaseAdapter
    {
        public readOnly_ADAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database, c_Advertisement.Table, username, password, port);
        }
        public readOnly_ADAdapter()
        {

        }

        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_Advertisement.m_id:
                    return MakeSelectStr(TableName, c_Advertisement.k_id, value);
                case c_Advertisement.m_Title:
                    return MakeSelectStr(TableName, c_Advertisement.k_Title, value);
                case c_Advertisement.m_Url:
                    return MakeSelectStr(TableName, c_Advertisement.k_Url, value);
                case c_Advertisement.m_Image:
                    return MakeSelectStr(TableName, c_Advertisement.k_Image, value);
                case c_Advertisement.m_Belong:
                    return MakeSelectStr(TableName, c_Advertisement.k_Belong, value);

            }
        }
    }
    /// <summary>
    /// 公司读取适配器
    /// </summary>
    public class readOnly_CompanyAdapter : ReadableDatabaseAdapter
    {

        public readOnly_CompanyAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database, c_Company.Table, username, password, port);
        }
        public readOnly_CompanyAdapter()
        {

        }
        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_Company.m_id:
                    return MakeSelectStr(TableName, c_Company.k_id, value);
                case c_Company.m_Name:
                    return MakeSelectStr(TableName, c_Company.k_Name, value);
                case c_Company.m_About:
                    return MakeSelectStr(TableName, c_Company.k_About, value);
                case c_Company.m_Phone:
                    return MakeSelectStr(TableName, c_Company.k_Phone, value);
                case c_Company.m_Email:
                    return MakeSelectStr(TableName, c_Company.k_Email, value);
                case c_Company.m_Type:
                    return MakeSelectStr(TableName, c_Company.k_Type, value);
            }
        }
    }
    /// <summary>
    /// 小区读取适配器
    /// </summary>
    public class readOnly_LocationAdapter : ReadableDatabaseAdapter
    {
        public readOnly_LocationAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database,c_Location.Table, username, password, port);
        }
        public readOnly_LocationAdapter()
        {

        }
        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_Location.m_id:
                    return MakeSelectStr(TableName, c_Location.k_id, value);
                case c_Location.m_Address:
                    return MakeSelectStr(TableName, c_Location.k_Address, value);
                case c_Location.m_Belong:
                    return MakeSelectStr(TableName, c_Location.k_Belong, value);
                case c_Location.m_Name:
                    return MakeSelectStr(TableName, c_Location.k_Name, value);
            }
        }
    }
    /// <summary>
    /// 订单读取适配器
    /// </summary>
    public class readOnly_OrderAdapter : ReadableDatabaseAdapter
    {
        public readOnly_OrderAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database, c_Order.Table, username, password, port);
        }
        public readOnly_OrderAdapter()
        {

        }
        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_Order.m_id:
                    return MakeSelectStr(TableName, c_Order.k_id, value);
                case c_Order.m_Address:
                    return MakeSelectStr(TableName, c_Order.k_Address, value);
                case c_Order.m_Belong:
                    return MakeSelectStr(TableName, c_Order.k_Belong, value);
                case c_Order.m_Number:
                    return MakeSelectStr(TableName, c_Order.k_Number, value);
                case c_Order.m_Price:
                    return MakeSelectStr(TableName, c_Order.k_Price, value);
                case c_Order.m_Seller:
                    return MakeSelectStr(TableName, c_Order.k_Seller, value);
                case c_Order.m_Status:
                    return MakeSelectStr(TableName, c_Order.k_Status, value);
                case c_Order.m_Time:
                    return MakeSelectStr(TableName, c_Order.k_Time, value);
            }
        }
    }
    /// <summary>
    /// 用户优惠适配器
    /// </summary>
    public class readOnly_UserDiscountAdapter : ReadableDatabaseAdapter
    {
        public readOnly_UserDiscountAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database, c_Discount.Table, username, password, port);
        }
        public readOnly_UserDiscountAdapter()
        {

        }
        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_Discount.m_id:
                    return MakeSelectStr(TableName, c_Discount.k_ID, value);
                case c_Discount.m_Order:
                    return MakeSelectStr(TableName, c_Discount.k_Order, value);
                case c_Discount.m_code:
                    return MakeSelectStr(TableName, c_Discount.k_Code, value);
                case c_Discount.m_Belong:
                    return MakeSelectStr(TableName, c_Discount.k_Belong, value);
                case c_Discount.m_PickTime:
                    return MakeSelectStr(TableName, c_Discount.k_PickTime, value);
                case c_Discount.m_Arg:
                    return MakeSelectStr(TableName, c_Discount.k_Arg, value);
            }
        }
    }
    /// <summary>
    /// 车位读取适配器
    /// </summary>
    public class readOnly_ParkTableAdapter : ReadableDatabaseAdapter
    {
        public readOnly_ParkTableAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database, c_Parking.Table, username, password, port);
        }
        public readOnly_ParkTableAdapter()
        {

        }
        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_Parking.m_id:
                    return MakeSelectStr(TableName, c_Parking.k_ID, value);
                case c_Parking.m_Location:
                    return MakeSelectStr(TableName, c_Parking.k_Location, value);
                case c_Parking.m_Number:
                    return MakeSelectStr(TableName, c_Parking.k_Number, value);
                case c_Parking.m_Note:
                    return MakeSelectStr(TableName, c_Parking.k_Note, value);
                case c_Parking.m_Status:
                    return MakeSelectStr(TableName, c_Parking.k_Status, value);
                case c_Parking.m_price:
                    return MakeSelectStr(TableName, c_Parking.k_Price, value);
            }
        }
    }
    /// <summary>
    /// 产权读取适配器
    /// </summary>
    public class readOnly_ParkRightAdapter : ReadableDatabaseAdapter
    {
        public readOnly_ParkRightAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database,c_Rights.Table, username, password, port);
        }
        public readOnly_ParkRightAdapter()
        {

        }
        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_Rights.m_belong:
                    return MakeSelectStr(TableName, c_Rights.k_Belong, value);
                case c_Rights.m_Item:
                    return MakeSelectStr(TableName, c_Rights.k_Item, value);
                case c_Rights.m_id:
                    return MakeSelectStr(TableName, c_Rights.k_ID, value);
            }
        }
    }
    /// <summary>
    /// 用户基本信息读取适配器
    /// </summary>
    public class safe_UserTableAdapter : ReadableDatabaseAdapter
    {
        public safe_UserTableAdapter(string server, string database, string username, string password, int port)
        {
            Init(server, database,c_User.Table, username, password, port);
        }
        public override string FindSelectStr(int mode, string value)
        {
            switch (mode)
            {
                default:
                    return MakeSelectStr(TableName);
                case c_User.m_id:
                    return MakeSelectStr(TableName, c_User.k_ID, value);
                case c_User.m_username:
                    return MakeSelectStr(TableName, c_User.k_UserName, value);
                case c_User.m_Phone:
                    return MakeSelectStr(TableName, c_User.k_Phone, value);
                case c_User.m_Location:
                    return MakeSelectStr(TableName, c_User.k_Location, value);
                case c_User.m_House:
                    return MakeSelectStr(TableName, c_User.k_House, value);
                case c_User.m_Number:
                    return MakeSelectStr(TableName, c_User.k_Number, value);
                case c_User.m_Password:
                    return MakeSelectStr(TableName, c_User.k_Password, value);
            }
        }
    }
}
